<template>
  <border-box title="发布渠道">
    <a-checkbox-group v-model="checkedList" :options="plainOptions">
      <span slot="label" slot-scope="{ value }">{{ value }}</span>
    </a-checkbox-group>
  </border-box>
</template>

<script>
  //发布渠道
  import BorderBox from "./BorderBox";
  import {getAction} from "../../api/manage";

  export default {
    name: "selectPublishChannel",
    components: {BorderBox},
    props: ['params'],
    data() {
      return {
        checkedList: [],
        plainOptions : [{
            value: 'website',
            label: '官网', 
          }, {
            value: 'wechat',
            label: '微信', 
          }, {
            value: 'weibo',
            label: '微博', 
          }, {
            value: 'trill',
            label: '抖音', 
          }, {
            value: 'video',
            label: '视频号', 
          }, {
            value: 'bilibili',
            label: 'B站', 
          }, {
            value: 'learning',
            label: '学习强国', 
          }, {
            value: 'renminhao',
            label: '人民号', 
          }, {
            value: 'kuaishou',
            label: '快手', 
          }]
      }
    },
    created() {
      this.queryInfo();
    },
    methods: {
      queryInfo() {
        getAction('task/taskInfo/queryTaskPublishInfo', this.params).then(res => {
          if (res.success) {
            this.checkedList = res.result.publishChannel || [];
          }
        })
      },
      selfValidate() {
        return new Promise((resolve, reject) => {
          const res = this.checkedList;
          resolve({key: 'selectPublishChannel', value: res})
        })
      },
    }
  }
</script>

<style scoped>
  .item {
    display: flex;
    align-items: center;
  }

  .item-half {
    flex: 1;
    margin-right: 5px;
  }

  .item-icon {
    cursor: pointer;
  }

</style>